<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>比较 innerHTM 和 innerText 区别</title>
</head>
<body>
<div id="com1">

</div>

<div id="com2">

</div>

<script>
  let element1 = document.querySelector("#com1");
  let element2 = document.querySelector("#com2");
  element1.innerHTML= "<h1>Hello</h1>"
  element2.innerText= "<h1>Hello</h1>"
</script>
</body>
</html>